(function() {
   (function initBackground() {
      var back = $(new Image());
      var backReady = false;
      var backCanvas = $('#back-canvas');
      var backCtx = backCanvas[0].getContext('2d');
      var body = $(document.body);
      
      var canvas = $('#map-canvas');
      var ctx = canvas[0].getContext('2d');
      
      var onResize = function() {
        if (backReady) {
          var w = body.width();
          var h = body.height();
          backCanvas.attr('height', h);
          backCanvas.attr('width', w);
          backCtx.drawImage(back[0], 0, 0, w, h);
          
          var leftWidth = $('#panel-left').width();
          canvas.attr('width',leftWidth);
          canvas.attr('height', h);
//          earth.major.redraw(leftWidth, h, canvas, ctx);
        }
      };
      
      var ready = function() {
        backReady = true;
        onResize();
      };
      
      back.load(ready);
      $(window).on('resize', onResize);
      back.attr('src', 'imgs/back.jpg');
   })();  

   (function setTitle() {
      var title = $('#title');
      title.html(new Date().toDateString());
    })();
 })();
